home *** CD-ROM | disk | FTP | other *** search
/ Java Programmer's Toolkit / Java Programmer's Toolkit.iso / gs3.53 / winmaps.ps < prev    next >
Text File  |  1996-01-10  |  4KB  |  108 lines

  1. %    Copyright (C) 1993 Aladdin Enterprises.  All rights reserved.
  2. % This file is part of Aladdin Ghostscript.
  3. % Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  4. % or distributor accepts any responsibility for the consequences of using it,
  5. % or for whether it serves any particular purpose or works at all, unless he
  6. % or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  7. % License (the "License") for full details.
  8. % Every copy of Aladdin Ghostscript must include a copy of the License,
  9. % normally in a plain ASCII text file named PUBLIC.  The License grants you
  10. % the right to copy, modify and redistribute Aladdin Ghostscript, but only
  11. % under certain conditions described in the License.  Among other things, the
  12. % License requires that the copyright notice and this notice be preserved on
  13. % all copies.
  14.  
  15. % winmaps.ps - make maps between PostScript encodings and Windows
  16. % character sets.
  17.  
  18. % Define the two Windows encodings.
  19.  
  20. /ANSIEncoding
  21.   ISOLatin1Encoding 256 array copy
  22.   dup 16#90 /.notdef put
  23.   16#93 1 16#9f { 2 copy /.notdef put pop } for
  24. def
  25.  
  26. /OEMEncoding [
  27.   /.notdef /.notdef /.notdef /heart /diamond /club /spade /bullet
  28.     8 { /.notdef } repeat
  29.   /.notdef /.notdef /.notdef /.notdef /paragraph /section /.notdef /.notdef
  30.     /arrowup /arrowdown /arrowright /arrowleft /.notdef /arrowboth /.notdef /.notdef
  31.   StandardEncoding 32 96 getinterval aload pop
  32.   /Ccedilla /udieresis /eacute /acircumflex /adieresis /agrave /aring /ccedilla
  33.     /ecircumflex /edieresis /egrave /idieresis /igrave /Adieresis /Aring
  34.   /Eacute /ae /AE /ocircumflex /odieresis /ograve /ucircumflex /ugrave
  35.     /ydieresis /Odieresis /Udieresis /cent /sterling /yen /.notdef /florin
  36.   /aacute /iacute /oacute /uacute /ntilde /Ntilde /ordfeminine /ordmasculine
  37.     /questiondown /.notdef /logicalnot /onehalf /onequarter /exclamdown /guillemotleft /guillemotright
  38.   48 { /.notdef } repeat
  39.   /alpha /beta /Gamma /Pi /Sigma /sigma /mu /tau
  40.     /Phi /Theta /Omega /delta /infinity /phi /element /intersection
  41.   /equivalence /plusminus /greaterequal /lessequal /integraltp /integralbt /divide /.notdef
  42.     /degree /dotmath /periodcentered /radical /.notdef /twosuperior /.notdef /.notdef
  43. ] def
  44.  
  45. % Utility procedures
  46.  
  47. /invertencoding        % <array> invertencoding <dict>
  48.  { 256 dict exch dup length 1 sub -1 0
  49.     {    % stack: dict array index
  50.       2 copy get /.notdef ne
  51.        { 2 copy get exch 3 index 3 1 roll put }
  52.        { pop }
  53.       ifelse
  54.     } for
  55.    pop
  56.  } def
  57.  
  58. /pmarray 256 array def
  59. /printmap        % <chars> <decode> printmap -
  60.  { mark 3 1 roll exch
  61.     { 2 copy known { 1 index exch get } { pop 0 } ifelse exch
  62.     }
  63.    forall pop
  64.    pmarray 0 counttomark 2 sub getinterval astore
  65.    ([) print dup length =only 0 exch (] = {\n  ) exch
  66.     { exch print =only
  67.       1 add 15 and dup 0 eq { (,\n  ) } { (, ) } ifelse
  68.     }
  69.    forall pop pop (\n};\n) print pop
  70.  } def
  71.  
  72. /decodeStd StandardEncoding invertencoding def
  73. /decodeISO ISOLatin1Encoding
  74.     % Remove the redundant characters
  75.   dup length array copy
  76.   [8#222 8#225 8#230 8#233 8#240] { 2 copy /.notdef put pop } forall
  77. invertencoding def
  78. /decodeSym SymbolEncoding invertencoding def
  79.  
  80. /decodeANSI ANSIEncoding invertencoding def
  81. /decodeOEM OEMEncoding invertencoding def
  82.  
  83. % Construct the map from Symbol to OEM.
  84.  
  85. (\nprivate const byte far_data gs_map_symbol_to_oem) print
  86. SymbolEncoding decodeOEM printmap
  87.  
  88. % Construct the map from ISOLatin1 to OEM.
  89.  
  90. (\nprivate const byte far_data gs_map_iso_to_oem) print
  91. ISOLatin1Encoding decodeOEM printmap
  92.  
  93. % Construct the map from Standard to ISOLatin1.
  94.  
  95. (\nprivate const byte far_data gs_map_std_to_iso) print
  96. StandardEncoding decodeISO printmap
  97.  
  98. % Construct the map from ISOLatin1 to Standard.
  99. % The Windows driver doesn't need this, but the X11 driver does.
  100.  
  101. (\nprivate const byte far_data gs_map_iso_to_std) print
  102. ISOLatin1Encoding decodeStd printmap
  103.  
  104. quit
  105.